package com.weiyuwqj.admin.controller.admin.sys;

import com.weiyuwqj.api.service.SysSiteService;
import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.api.model.SysSite;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2015/12/11.
 */
@Controller
@RequestMapping("/sys/site")
public class SiteController {
    @Autowired
    SysSiteService sysSiteService;

    @ResponseBody
    @RequestMapping(value ="/list",method= RequestMethod.POST)
    public Object list(Paginator p,
                       Integer style,
                       String siteName,
                       String beginDateTime,
                       String endDateTime){
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("style",style);
        map.put("siteName",siteName);
        map.put("beginDateTime",beginDateTime);
        map.put("endDateTime",endDateTime);
        return sysSiteService.getList(p,map);
    }

    @ResponseBody
    @RequestMapping(value = "/getSingle",method = RequestMethod.POST)
        public Object getSingle(String nid) {
        SysSite site=new SysSite();
        site.setNid(nid);
        return sysSiteService.selectOne(site);
    }
}
